package GUI;

import ClientServer.Server;
import Command.CommandStatement;
import Command.Constant_Command;
import DataAccess.DataManagement;
import static GUI.ComputerPanel.CLOSE;
import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.Socket;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Van Cong
 */
public class MainScreen extends javax.swing.JFrame {

    /**
     * Creates new form MainScreen
     */
    public static final int COMPUTERS_SCREEN = 0;
    public static final int STATISTICS_SCREEN = 2;
    public static final int EMPLOY_INFORMATION_SCREEN = 3;
    public static final int TRANSACTION_JOUNAL_SCREEN = 4;
    public static final int CLIENT_INFORMATION_SCREEN = 5;
    public static final int COMPUTER_MANAGEMENT_SCREEN = 6;
    public static final int WEB_MANAGEMENT_SCREEN = 7;
    public static final int WEB_HISTORY_SCREEN = 8;
    DefaultTableModel tbModel;
    Object[][] data;
    String[] title;
    static DataManagement dataMana;
    JPopupMenu popupMenu;
    private Server server;
    private Login login;
    private PasswordChange passwordChange;
    private AccountCreate accountCreate;
    String account, password;

    public MainScreen(Login loginNew) throws IOException {
        initComponents();
        JPanel panel = new JPanel(new BorderLayout());
        server = new Server(this);
        panel.add(pnMainScreen, BorderLayout.CENTER);
        panel.add(pnIcon, BorderLayout.NORTH);
        pnComputerScreen.setLayout(new FlowLayout(10, 30, 30));
        setPanel(COMPUTERS_SCREEN);
        setContentPane(panel);
        dataMana=new DataManagement();
        Toolkit tk = Toolkit.getDefaultToolkit();
        int xSize = ((int) tk.getScreenSize().getWidth());
        int ySize = ((int) tk.getScreenSize().getHeight());
        setSize(xSize, ySize - 30);
        requestFocus();
        LB_Price.setText(LB_Price.getText()+Login.pricePerHour);        
        LB_IP.setText(LB_IP.getText()+Server.ip);
        login = loginNew;
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                hideGui();
            }
        });
        trayIcon();
        data = new Object[][]{};
        title = new String[]{
            "Tên khách hàng", "Máy sử dụng", "Người quản lý", "Thời gian bắt đầu", "Thời gian sử dụng", "Số tiền"
        };
        tbModel = new DefaultTableModel(data, title);
        tbTransactionJournal.setModel(tbModel);
        initComputerList();
    }

    public void initComputerList() {
        try {
            String query = "SELECT * FROM COMPUTER";
            ResultSet resultSet = Login.dtConnect.retriveData(query);
            while (resultSet.next()) {
                ComputerPanel computer = new ComputerPanel(ComputerPanel.CLOSE, "Máy " + resultSet.getInt(1), null);
                pnComputerScreen.add(computer);
            }
            setContentPane(getContentPane());
        } catch (SQLException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void setMainScreen(JPanel pnMain) {
        pnMainScreen.removeAll();
        pnMainScreen.add(pnMain, BorderLayout.CENTER);
        setContentPane(getContentPane());
    }

    public void closeAllComputer() {
        int len = pnComputerScreen.getComponentCount();
        for (int i = 0; i < len; i++) {
            ((ComputerPanel) pnComputerScreen.getComponent(i)).computerClose();
        }
    }

    public void hideGui() {
        this.dispose();
    }

    public void setAccount() {
        lbAccount.setText(account);
    }

    public void setAccount(String account, String password) {
        this.account = account;
        this.password = password;
    }

    public void setComputer(Socket socket, int id) {
        ComputerPanel computer = (ComputerPanel) pnComputerScreen.getComponent(id - 1);
        computer.setSocket(socket);
    }

    public void newComputer(Socket socket, int id) {
        ComputerPanel computer = new ComputerPanel(ComputerPanel.OPEN, "Máy " + id, socket);
        computer.setStatus(ComputerPanel.OPEN);
        pnComputerScreen.add(computer);
        setContentPane(getContentPane());
    }

    public DefaultTableModel getTableModel(Vector title, Vector content) {
        DefaultTableModel tableModel = new DefaultTableModel(content, title) {
            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        return tableModel;
    }

    public void setAction(String readUTF) {
        // DataOutputStream dataOut = ser
    }

    public void setScreenStatus(int status, boolean all) {
        int len = pnComputerScreen.getComponentCount();
        ComputerPanel computerPanel;
        for (int i = 0; i < len; i++) {
            computerPanel = (ComputerPanel) pnComputerScreen.getComponent(i);
            computerPanel.setVisible(computerPanel.getStatus() == status || all);
        }
    }

    public void trayIcon() {
        try {
            if (!SystemTray.isSupported()) {
                System.out.println("SystemTray is not supported");
                return;
            }

            SystemTray tray = SystemTray.getSystemTray();
            Toolkit toolkit = Toolkit.getDefaultToolkit();
            Image image = toolkit.getImage(getClass().getResource("../Images/icon.png"));
            PopupMenu menu = new PopupMenu();
            MenuItem logoutItem = new MenuItem("Đăng xuất");
            logoutItem.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    logout();
                }
            });
            menu.add(logoutItem);
            MenuItem close = new MenuItem("Tắt phần mềm");
            close.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    closeAllComputer();
                    System.exit(0);
                }
            });
            menu.add(close);

            TrayIcon icon = new TrayIcon(image, "SystemTray Demo", menu);
            icon.setImageAutoSize(true);
            tray.add(icon);
            icon.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    showGui();
                }
            });
        } catch (AWTException ex) {
        }
    }

    public void showGui() {
        this.show();
    }

    public void closeGui() {
        int result = JOptionPane.showConfirmDialog(null, "Bạn có chắc chắn muốn đóng phần mềm không?", "Cảnh báo đóng phần mềm.", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (result == JOptionPane.YES_OPTION) {
            closeAllComputer();
            System.exit(0);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnIcon = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jButton3 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jButton13 = new javax.swing.JButton();
        LB_IP = new javax.swing.JLabel();
        LB_Price = new javax.swing.JLabel();
        BT_ChangePrice = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jButton6 = new javax.swing.JButton();
        btExitProgram = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        btCloseAllComputer = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        lbAccount = new javax.swing.JLabel();
        jButton9 = new javax.swing.JButton();
        pnMainScreen = new javax.swing.JPanel();
        pnComputerScreen = new javax.swing.JPanel();
        pnStastisticsScreen = new javax.swing.JPanel();
        pnStastistics = new javax.swing.JPanel();
        jSeparator2 = new javax.swing.JSeparator();
        scStastistics = new javax.swing.JScrollPane();
        jPanel6 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        jButton22 = new javax.swing.JButton();
        jButton23 = new javax.swing.JButton();
        jButton24 = new javax.swing.JButton();
        pnTransactionJournal = new javax.swing.JPanel();
        jPanel32 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        cbbDate = new javax.swing.JComboBox();
        cbbMouth = new javax.swing.JComboBox();
        jLabel14 = new javax.swing.JLabel();
        jLabel26 = new javax.swing.JLabel();
        cbbYear = new javax.swing.JComboBox();
        txtUser = new javax.swing.JTextField();
        btSearch = new javax.swing.JButton();
        btViewAll = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();
        txtNumDate = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        btView = new javax.swing.JButton();
        jPanel16 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        tbTransactionJournal = new javax.swing.JTable();
        pnEmployInformation = new javax.swing.JPanel();
        jPanel33 = new javax.swing.JPanel();
        TF_EmployeeSearch = new javax.swing.JTextField();
        BT_SearchEmployees = new javax.swing.JButton();
        jLabel37 = new javax.swing.JLabel();
        BT_ListAllEmployees = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        Table_Employees = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        pnClientInformation = new javax.swing.JPanel();
        jPanel34 = new javax.swing.JPanel();
        TF_ClientName = new javax.swing.JTextField();
        BT_SearchClient = new javax.swing.JButton();
        jScrollPane4 = new javax.swing.JScrollPane();
        Table_Client = new javax.swing.JTable();
        BT_ListAllClients = new javax.swing.JButton();
        jLabel36 = new javax.swing.JLabel();
        jPanel12 = new javax.swing.JPanel();
        pnStastisticsDay = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        cbbDateStt = new javax.swing.JComboBox();
        cbbMonthStt = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        cbbSL = new javax.swing.JComboBox();
        cbbYearStt = new javax.swing.JComboBox();
        btShow = new javax.swing.JButton();
        jPanel18 = new javax.swing.JPanel();
        jSplitPane3 = new javax.swing.JSplitPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbDayStt = new javax.swing.JTable();
        jPanel5 = new javax.swing.JPanel();
        pnStatictis1 = new javax.swing.JPanel();
        jPanel21 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        lbDay = new javax.swing.JLabel();
        pnStastisticsMonth = new javax.swing.JPanel();
        jPanel27 = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        cbbMonthStt2 = new javax.swing.JComboBox();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        cbbSL2 = new javax.swing.JComboBox();
        cbbYearStt2 = new javax.swing.JComboBox();
        btShow2 = new javax.swing.JButton();
        jPanel28 = new javax.swing.JPanel();
        jSplitPane5 = new javax.swing.JSplitPane();
        jScrollPane8 = new javax.swing.JScrollPane();
        tbMonthStt = new javax.swing.JTable();
        jPanel29 = new javax.swing.JPanel();
        pnStatictis2 = new javax.swing.JPanel();
        jPanel31 = new javax.swing.JPanel();
        jLabel24 = new javax.swing.JLabel();
        lbMouth = new javax.swing.JLabel();
        pnStastisticsYear = new javax.swing.JPanel();
        jPanel22 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        cbbSL3 = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        cbbYearStt3 = new javax.swing.JComboBox();
        btShow3 = new javax.swing.JButton();
        jPanel23 = new javax.swing.JPanel();
        jSplitPane4 = new javax.swing.JSplitPane();
        jScrollPane7 = new javax.swing.JScrollPane();
        tbYearStt = new javax.swing.JTable();
        jPanel24 = new javax.swing.JPanel();
        pnStatictis3 = new javax.swing.JPanel();
        jPanel26 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        lbYear = new javax.swing.JLabel();
        pnStatusComputer = new javax.swing.JPanel();
        jButton16 = new javax.swing.JButton();
        jButton17 = new javax.swing.JButton();
        jButton14 = new javax.swing.JButton();
        jButton15 = new javax.swing.JButton();

        jPanel2.setBackground(new java.awt.Color(255, 204, 204));
        jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/computer.png"))); // NOI18N
        jButton3.setText("Trình trạng máy");
        jButton3.setContentAreaFilled(false);
        jButton3.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jButton3StateChanged(evt);
            }
        });
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/bieu do.png"))); // NOI18N
        jButton8.setText("Thống kê");
        jButton8.setContentAreaFilled(false);
        jButton8.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jButton8StateChanged(evt);
            }
        });
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/nhat ky giao dich.jpg"))); // NOI18N
        jButton10.setText("Nhật ký giao dịch");
        jButton10.setContentAreaFilled(false);
        jButton10.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jButton10StateChanged(evt);
            }
        });
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        jButton11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/quan ly may tinh.png"))); // NOI18N
        jButton11.setText("Thông tin nhân viên");
        jButton11.setContentAreaFilled(false);
        jButton11.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jButton11StateChanged(evt);
            }
        });
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jButton13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Acounts.png"))); // NOI18N
        jButton13.setText("Thông tin khách hàng");
        jButton13.setContentAreaFilled(false);
        jButton13.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jButton13StateChanged(evt);
            }
        });
        jButton13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton13ActionPerformed(evt);
            }
        });

        LB_IP.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        LB_IP.setForeground(new java.awt.Color(0, 0, 204));
        LB_IP.setText("Địa chỉ IP máy chủ: ");

        LB_Price.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        LB_Price.setForeground(new java.awt.Color(255, 0, 0));
        LB_Price.setText("Đơn giá: ");

        BT_ChangePrice.setText("Thay đổi");
        BT_ChangePrice.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BT_ChangePriceActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jButton8)
                .addGap(0, 0, 0)
                .addComponent(jButton10)
                .addGap(0, 0, 0)
                .addComponent(jButton11)
                .addGap(0, 0, 0)
                .addComponent(jButton13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(LB_IP)
                .addGap(18, 18, 18)
                .addComponent(LB_Price)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BT_ChangePrice)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton10)
                        .addComponent(jButton11)
                        .addComponent(jButton13)
                        .addComponent(LB_IP)
                        .addComponent(LB_Price)
                        .addComponent(BT_ChangePrice))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton8)
                        .addComponent(jButton3))))
        );

        jPanel3.setBackground(new java.awt.Color(155, 155, 253));
        jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jButton6.setBackground(new java.awt.Color(244, 164, 96));
        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Logout_22.png"))); // NOI18N
        jButton6.setText("Đăng xuất");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        btExitProgram.setBackground(new java.awt.Color(244, 164, 96));
        btExitProgram.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Exit_22.png"))); // NOI18N
        btExitProgram.setText("Kết thúc");
        btExitProgram.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btExitProgramActionPerformed(evt);
            }
        });

        jButton2.setBackground(new java.awt.Color(244, 164, 96));
        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Account.png"))); // NOI18N
        jButton2.setText("Tạo tài khoản");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton4.setBackground(new java.awt.Color(244, 164, 96));
        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/GioiThieu_22.png"))); // NOI18N
        jButton4.setText("Thông tin");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        btCloseAllComputer.setBackground(new java.awt.Color(244, 164, 96));
        btCloseAllComputer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/CloseAll.png"))); // NOI18N
        btCloseAllComputer.setText("Đóng toàn bộ máy");
        btCloseAllComputer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCloseAllComputerActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        jLabel1.setText("Người sử dụng:");

        lbAccount.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        lbAccount.setForeground(new java.awt.Color(255, 255, 51));
        lbAccount.setText("admin");

        jButton9.setBackground(new java.awt.Color(244, 164, 96));
        jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/passwordChange.png"))); // NOI18N
        jButton9.setText("Đôi mật khẩu");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbAccount)
                .addGap(30, 30, 30)
                .addComponent(btCloseAllComputer)
                .addGap(30, 30, 30)
                .addComponent(jButton6)
                .addGap(30, 30, 30)
                .addComponent(jButton2)
                .addGap(30, 30, 30)
                .addComponent(jButton9)
                .addGap(30, 30, 30)
                .addComponent(jButton4)
                .addGap(30, 30, 30)
                .addComponent(btExitProgram)
                .addContainerGap(200, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton6)
                    .addComponent(btExitProgram)
                    .addComponent(jButton2)
                    .addComponent(jButton4)
                    .addComponent(btCloseAllComputer)
                    .addComponent(jLabel1)
                    .addComponent(lbAccount)
                    .addComponent(jButton9))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnIconLayout = new javax.swing.GroupLayout(pnIcon);
        pnIcon.setLayout(pnIconLayout);
        pnIconLayout.setHorizontalGroup(
            pnIconLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pnIconLayout.setVerticalGroup(
            pnIconLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnIconLayout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pnMainScreen.setBackground(new java.awt.Color(253, 225, 253));
        pnMainScreen.setLayout(new java.awt.BorderLayout());

        pnComputerScreen.setBackground(new java.awt.Color(170, 249, 170));

        javax.swing.GroupLayout pnComputerScreenLayout = new javax.swing.GroupLayout(pnComputerScreen);
        pnComputerScreen.setLayout(pnComputerScreenLayout);
        pnComputerScreenLayout.setHorizontalGroup(
            pnComputerScreenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 460, Short.MAX_VALUE)
        );
        pnComputerScreenLayout.setVerticalGroup(
            pnComputerScreenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 295, Short.MAX_VALUE)
        );

        pnStastisticsScreen.setBackground(new java.awt.Color(247, 234, 247));
        pnStastisticsScreen.setLayout(new java.awt.BorderLayout());

        pnStastistics.setLayout(new java.awt.BorderLayout());
        pnStastistics.add(jSeparator2, java.awt.BorderLayout.NORTH);
        pnStastistics.add(scStastistics, java.awt.BorderLayout.CENTER);

        pnStastisticsScreen.add(pnStastistics, java.awt.BorderLayout.CENTER);

        jPanel6.setAlignmentX(0.0F);
        jPanel6.setAlignmentY(0.0F);
        jPanel6.setName(""); // NOI18N
        jPanel6.setLayout(new java.awt.BorderLayout());

        jPanel19.setBackground(new java.awt.Color(204, 255, 204));

        jButton22.setText("Thống kê theo ngày");
        jButton22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton22ActionPerformed(evt);
            }
        });
        jPanel19.add(jButton22);

        jButton23.setText("Thống kê theo tháng");
        jButton23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton23ActionPerformed(evt);
            }
        });
        jPanel19.add(jButton23);

        jButton24.setText("Thống kê theo năm ");
        jButton24.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton24ActionPerformed(evt);
            }
        });
        jPanel19.add(jButton24);

        jPanel6.add(jPanel19, java.awt.BorderLayout.NORTH);

        pnStastisticsScreen.add(jPanel6, java.awt.BorderLayout.NORTH);

        pnTransactionJournal.setBackground(new java.awt.Color(233, 247, 247));
        pnTransactionJournal.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        pnTransactionJournal.setLayout(new java.awt.BorderLayout());

        jLabel11.setText("Ngày bắt đầu: Ngày ");

        cbbDate.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        cbbMouth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "11", "12" }));

        jLabel14.setText("Tháng");

        jLabel26.setText("Năm");

        cbbYear.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));

        btSearch.setText("Tìm kiếm");
        btSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSearchActionPerformed(evt);
            }
        });

        btViewAll.setText("Xem toàn bộ");
        btViewAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btViewAllActionPerformed(evt);
            }
        });

        jLabel27.setText("Số Ngày:");

        jLabel28.setText("Nhập Tên khách hàng:");

        btView.setText("Xem");
        btView.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btViewActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel32Layout = new javax.swing.GroupLayout(jPanel32);
        jPanel32.setLayout(jPanel32Layout);
        jPanel32Layout.setHorizontalGroup(
            jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel32Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel32Layout.createSequentialGroup()
                        .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbbDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbbMouth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel26)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(cbbYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(txtNumDate, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btView)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btViewAll))
                    .addGroup(jPanel32Layout.createSequentialGroup()
                        .addComponent(jLabel28)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtUser, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btSearch)))
                .addContainerGap(359, Short.MAX_VALUE))
        );
        jPanel32Layout.setVerticalGroup(
            jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel32Layout.createSequentialGroup()
                .addGroup(jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbMouth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btViewAll)
                    .addComponent(jLabel27)
                    .addComponent(txtNumDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btView))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btSearch)
                    .addComponent(jLabel28))
                .addGap(0, 9, Short.MAX_VALUE))
        );

        pnTransactionJournal.add(jPanel32, java.awt.BorderLayout.PAGE_START);

        jPanel16.setLayout(new java.awt.BorderLayout());

        tbTransactionJournal.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Title 1", "Title 2", "Title 3"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbTransactionJournal.setToolTipText("");
        tbTransactionJournal.getTableHeader().setResizingAllowed(false);
        tbTransactionJournal.getTableHeader().setReorderingAllowed(false);
        jScrollPane6.setViewportView(tbTransactionJournal);

        jPanel16.add(jScrollPane6, java.awt.BorderLayout.CENTER);

        pnTransactionJournal.add(jPanel16, java.awt.BorderLayout.CENTER);

        pnEmployInformation.setBackground(new java.awt.Color(212, 253, 212));
        pnEmployInformation.setLayout(new java.awt.BorderLayout());

        BT_SearchEmployees.setText("Tìm kiếm");
        BT_SearchEmployees.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BT_SearchEmployeesActionPerformed(evt);
            }
        });

        jLabel37.setText("Nhập tên nhân viên:");

        BT_ListAllEmployees.setText("Liệt kê tất cả các nhân viên");
        BT_ListAllEmployees.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BT_ListAllEmployeesActionPerformed(evt);
            }
        });

        Table_Employees.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        Table_Employees.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Tên nhân viên", "Mã nhân viên", "Địa chỉ liên lạc", "Tiền lương ứng trước", "Số ca làm trong tháng", "Ghi chú"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        Table_Employees.getTableHeader().setResizingAllowed(false);
        Table_Employees.getTableHeader().setReorderingAllowed(false);
        Table_Employees.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                Table_EmployeesMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(Table_Employees);

        javax.swing.GroupLayout jPanel33Layout = new javax.swing.GroupLayout(jPanel33);
        jPanel33.setLayout(jPanel33Layout);
        jPanel33Layout.setHorizontalGroup(
            jPanel33Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel33Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel37)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(TF_EmployeeSearch, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BT_SearchEmployees)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BT_ListAllEmployees)
                .addContainerGap(507, Short.MAX_VALUE))
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        jPanel33Layout.setVerticalGroup(
            jPanel33Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel33Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel33Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel37)
                    .addComponent(TF_EmployeeSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BT_SearchEmployees)
                    .addComponent(BT_ListAllEmployees))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 613, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        pnEmployInformation.add(jPanel33, java.awt.BorderLayout.PAGE_START);

        jPanel1.setLayout(new java.awt.BorderLayout());
        pnEmployInformation.add(jPanel1, java.awt.BorderLayout.CENTER);

        pnClientInformation.setBackground(new java.awt.Color(252, 238, 216));
        pnClientInformation.setLayout(new java.awt.BorderLayout());

        BT_SearchClient.setText("Tìm kiếm");
        BT_SearchClient.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BT_SearchClientActionPerformed(evt);
            }
        });

        Table_Client.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        Table_Client.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Tên khách hàng", "Số phút còn lại trong tài khoản", "Thời gian sử dụng gần nhất", "Số phút sử dụng trong lần sử dụng cuối", "Ngày nộp tiền gần nhất", "Số tiền nộp gần nhất."
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        Table_Client.getTableHeader().setResizingAllowed(false);
        Table_Client.getTableHeader().setReorderingAllowed(false);
        Table_Client.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                Table_ClientMouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(Table_Client);

        BT_ListAllClients.setText("Liệt kê tất cả khách hàng");
        BT_ListAllClients.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BT_ListAllClientsActionPerformed(evt);
            }
        });

        jLabel36.setText("Nhập tên khách hàng:");

        javax.swing.GroupLayout jPanel34Layout = new javax.swing.GroupLayout(jPanel34);
        jPanel34.setLayout(jPanel34Layout);
        jPanel34Layout.setHorizontalGroup(
            jPanel34Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel34Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel36)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(TF_ClientName, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BT_SearchClient)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BT_ListAllClients)
                .addContainerGap(490, Short.MAX_VALUE))
            .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING)
        );
        jPanel34Layout.setVerticalGroup(
            jPanel34Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel34Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel34Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TF_ClientName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(BT_SearchClient)
                    .addComponent(BT_ListAllClients)
                    .addComponent(jLabel36))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE))
        );

        pnClientInformation.add(jPanel34, java.awt.BorderLayout.PAGE_START);

        jPanel12.setLayout(new java.awt.BorderLayout());
        pnClientInformation.add(jPanel12, java.awt.BorderLayout.CENTER);

        pnStastisticsDay.setBackground(new java.awt.Color(192, 211, 190));
        pnStastisticsDay.setLayout(new java.awt.BorderLayout());

        jLabel2.setText("Ngày bắt đầu: Ngày ");

        cbbDateStt.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        cbbMonthStt.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "11", "12" }));

        jLabel3.setText("Tháng");

        jLabel4.setText("Năm");

        jLabel5.setText("Số ngày cần thống kê");

        cbbSL.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }));

        cbbYearStt.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));

        btShow.setText("Xem");
        btShow.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btShowActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
        jPanel17.setLayout(jPanel17Layout);
        jPanel17Layout.setHorizontalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel17Layout.createSequentialGroup()
                        .addComponent(cbbDateStt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(30, 30, 30)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbbMonthStt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(30, 30, 30)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbbYearStt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel17Layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addComponent(cbbSL, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btShow)))
                .addContainerGap(617, Short.MAX_VALUE))
        );
        jPanel17Layout.setVerticalGroup(
            jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel17Layout.createSequentialGroup()
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbDateStt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbMonthStt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbYearStt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbSL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btShow)))
        );

        pnStastisticsDay.add(jPanel17, java.awt.BorderLayout.PAGE_START);

        jPanel18.setLayout(new java.awt.BorderLayout());

        jSplitPane3.setResizeWeight(0.6);

        tbDayStt.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Ngày/tháng/năm", "Tổng số tiền thu được"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tbDayStt.getTableHeader().setResizingAllowed(false);
        tbDayStt.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(tbDayStt);

        jSplitPane3.setLeftComponent(jScrollPane1);

        jPanel5.setLayout(new java.awt.BorderLayout());

        javax.swing.GroupLayout pnStatictis1Layout = new javax.swing.GroupLayout(pnStatictis1);
        pnStatictis1.setLayout(pnStatictis1Layout);
        pnStatictis1Layout.setHorizontalGroup(
            pnStatictis1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 518, Short.MAX_VALUE)
        );
        pnStatictis1Layout.setVerticalGroup(
            pnStatictis1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );

        jPanel5.add(pnStatictis1, java.awt.BorderLayout.CENTER);

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel8.setText("Biểu đồ doanh thu của ngày:");
        jPanel21.add(jLabel8);

        lbDay.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbDay.setText("01/01/2014.");
        jPanel21.add(lbDay);

        jPanel5.add(jPanel21, java.awt.BorderLayout.NORTH);

        jSplitPane3.setRightComponent(jPanel5);

        jPanel18.add(jSplitPane3, java.awt.BorderLayout.CENTER);

        pnStastisticsDay.add(jPanel18, java.awt.BorderLayout.CENTER);

        pnStastisticsMonth.setBackground(new java.awt.Color(192, 211, 190));
        pnStastisticsMonth.setLayout(new java.awt.BorderLayout());

        jLabel18.setText("Tháng bắt đầu:");

        cbbMonthStt2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "11", "12" }));

        jLabel19.setText("Tháng");

        jLabel20.setText("Năm");

        jLabel21.setText("Chọn số tháng thống kê:");

        cbbSL2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));

        cbbYearStt2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));

        btShow2.setText("Xem");
        btShow2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btShow2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
        jPanel27.setLayout(jPanel27Layout);
        jPanel27Layout.setHorizontalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel27Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel21)
                    .addComponent(jLabel18))
                .addGap(30, 30, 30)
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel27Layout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbbMonthStt2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(cbbSL2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(30, 30, 30)
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel27Layout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbbYearStt2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(btShow2))
                .addContainerGap(643, Short.MAX_VALUE))
        );
        jPanel27Layout.setVerticalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel27Layout.createSequentialGroup()
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbMonthStt2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbYearStt2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
                .addGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbSL2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btShow2)))
        );

        pnStastisticsMonth.add(jPanel27, java.awt.BorderLayout.PAGE_START);

        jPanel28.setLayout(new java.awt.BorderLayout());

        jSplitPane5.setResizeWeight(0.6);

        tbMonthStt.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Tháng/năm", "Tổng số tiền thu được", "Tổng chi phí", "Lợi nhuận"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tbMonthStt.getTableHeader().setResizingAllowed(false);
        tbMonthStt.getTableHeader().setReorderingAllowed(false);
        jScrollPane8.setViewportView(tbMonthStt);

        jSplitPane5.setLeftComponent(jScrollPane8);

        jPanel29.setLayout(new java.awt.BorderLayout());

        javax.swing.GroupLayout pnStatictis2Layout = new javax.swing.GroupLayout(pnStatictis2);
        pnStatictis2.setLayout(pnStatictis2Layout);
        pnStatictis2Layout.setHorizontalGroup(
            pnStatictis2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 518, Short.MAX_VALUE)
        );
        pnStatictis2Layout.setVerticalGroup(
            pnStatictis2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );

        jPanel29.add(pnStatictis2, java.awt.BorderLayout.CENTER);

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel24.setText("Biểu đồ doanh thu tháng:");
        jPanel31.add(jLabel24);

        lbMouth.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbMouth.setText("01/2014.");
        jPanel31.add(lbMouth);

        jPanel29.add(jPanel31, java.awt.BorderLayout.NORTH);

        jSplitPane5.setRightComponent(jPanel29);

        jPanel28.add(jSplitPane5, java.awt.BorderLayout.CENTER);

        pnStastisticsMonth.add(jPanel28, java.awt.BorderLayout.CENTER);

        pnStastisticsYear.setBackground(new java.awt.Color(192, 211, 190));
        pnStastisticsYear.setLayout(new java.awt.BorderLayout());

        jLabel10.setText("Năm bắt đầu:");

        cbbSL3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5" }));

        jLabel12.setText("Năm");

        jLabel13.setText("Số lượng năm thống kê:");

        cbbYearStt3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));

        btShow3.setText("Xem");
        btShow3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btShow3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13)
                    .addComponent(jLabel10))
                .addGap(18, 18, 18)
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel22Layout.createSequentialGroup()
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(cbbYearStt3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(cbbSL3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btShow3, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(674, Short.MAX_VALUE))
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel22Layout.createSequentialGroup()
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbYearStt3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cbbSL3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btShow3)))
        );

        pnStastisticsYear.add(jPanel22, java.awt.BorderLayout.PAGE_START);

        jPanel23.setLayout(new java.awt.BorderLayout());

        jSplitPane4.setResizeWeight(0.6);

        tbYearStt.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Năm", "Tổng số tiền thu được", "Tổng chi phí", "Lợi nhuận"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        tbYearStt.getTableHeader().setResizingAllowed(false);
        tbYearStt.getTableHeader().setReorderingAllowed(false);
        jScrollPane7.setViewportView(tbYearStt);

        jSplitPane4.setLeftComponent(jScrollPane7);

        jPanel24.setLayout(new java.awt.BorderLayout());

        javax.swing.GroupLayout pnStatictis3Layout = new javax.swing.GroupLayout(pnStatictis3);
        pnStatictis3.setLayout(pnStatictis3Layout);
        pnStatictis3Layout.setHorizontalGroup(
            pnStatictis3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 518, Short.MAX_VALUE)
        );
        pnStatictis3Layout.setVerticalGroup(
            pnStatictis3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );

        jPanel24.add(pnStatictis3, java.awt.BorderLayout.CENTER);

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel16.setText("Biểu đồ doanh thu của năm:");
        jPanel26.add(jLabel16);

        lbYear.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbYear.setText("2014.");
        jPanel26.add(lbYear);

        jPanel24.add(jPanel26, java.awt.BorderLayout.NORTH);

        jSplitPane4.setRightComponent(jPanel24);

        jPanel23.add(jSplitPane4, java.awt.BorderLayout.CENTER);

        pnStastisticsYear.add(jPanel23, java.awt.BorderLayout.CENTER);

        pnStatusComputer.setBackground(new java.awt.Color(204, 255, 255));

        jButton16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton16.setText("Các máy đang mở");
        jButton16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton16ActionPerformed(evt);
            }
        });
        pnStatusComputer.add(jButton16);

        jButton17.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton17.setText("Các máy đã đóng");
        jButton17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton17ActionPerformed(evt);
            }
        });
        pnStatusComputer.add(jButton17);

        jButton14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton14.setText("Các máy đang sử dụng");
        jButton14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton14ActionPerformed(evt);
            }
        });
        pnStatusComputer.add(jButton14);

        jButton15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton15.setText("Tất cả các máy");
        jButton15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton15ActionPerformed(evt);
            }
        });
        pnStatusComputer.add(jButton15);

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Quản lý internet");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 449, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 223, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    public void setPanel(int screen) {
        switch (screen) {
            case COMPUTERS_SCREEN:
                setMainScreen(pnComputerScreen);
                pnMainScreen.add(pnStatusComputer, BorderLayout.NORTH);
                setContentPane(getContentPane());
                break;
            case STATISTICS_SCREEN:
                setMainScreen(pnStastisticsScreen);
                break;
            case EMPLOY_INFORMATION_SCREEN:
                setMainScreen(pnEmployInformation);
                break;
            case TRANSACTION_JOUNAL_SCREEN:
                setMainScreen(pnTransactionJournal);
                break;
            case CLIENT_INFORMATION_SCREEN:
                setMainScreen(pnClientInformation);
                break;
            case WEB_MANAGEMENT_SCREEN:
                setMainScreen(pnStastisticsMonth);
                break;
            case WEB_HISTORY_SCREEN:
                setMainScreen(pnStastisticsYear);
                break;
        }
    }

    public void rsTotable(ResultSet rs) {
        DefaultTableModel newModel = new DefaultTableModel(title, 0) {
            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        try {
            while (rs.next()) {
                String[] rowData = new String[6];
                for (int i = 0; i < 6; i++) {
                    rowData[i] = rs.getString(i + 1);
                }
                newModel.addRow(rowData);
            }
            tbTransactionJournal.setModel(newModel);
        } catch (SQLException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void rsTotable(ResultSet rs, int ngay, int thang, int nam, int songay) {
        tbModel = new DefaultTableModel(title, 0) {
            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        try {
            while (rs.next()) {
                String[] rowData = new String[6];
                //------------------------------
                SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
                Date dateStart = sdf.parse(ngay + "/" + thang + "/" + nam);
                long start = dateStart.getTime();
                long end = start + songay * 3600 * 24;
                Date date = rs.getDate(4);
                long dd = date.getTime();
                //-------------------------------
                if (dd >= start && dd <= end) {
                    for (int i = 0; i < 6; i++) {
                        rowData[i] = rs.getString(i + 1);
                    }
                    tbModel.addRow(rowData);
                }
            }
            tbTransactionJournal.setModel(tbModel);
        } catch (SQLException | ParseException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        // TODO add your handling code here:
        setPanel(COMPUTERS_SCREEN);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        // TODO add your handling code here:
        setPanel(STATISTICS_SCREEN);
        scStastistics.setViewportView(pnStastisticsDay);
    }//GEN-LAST:event_jButton8ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        // TODO add your handling code here:
        setPanel(TRANSACTION_JOUNAL_SCREEN);
    }//GEN-LAST:event_jButton10ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        // TODO add your handling code here:
        setPanel(EMPLOY_INFORMATION_SCREEN);
    }//GEN-LAST:event_jButton11ActionPerformed

    private void jButton3StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jButton3StateChanged
        // TODO add your handling code here:
        // ButtonModel model = (ButtonModel) evt.getSource();
        AbstractButton aButton = (AbstractButton) evt.getSource();
        ButtonModel aModel = aButton.getModel();
        jButton3.setContentAreaFilled(aModel.isRollover());
    }//GEN-LAST:event_jButton3StateChanged

    private void jButton8StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jButton8StateChanged
        // TODO add your handling code here:
        AbstractButton aButton = (AbstractButton) evt.getSource();
        ButtonModel aModel = aButton.getModel();
        jButton8.setContentAreaFilled(aModel.isRollover());
    }//GEN-LAST:event_jButton8StateChanged

    private void jButton10StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jButton10StateChanged
        // TODO add your handling code here:
        AbstractButton aButton = (AbstractButton) evt.getSource();
        ButtonModel aModel = aButton.getModel();
        jButton10.setContentAreaFilled(aModel.isRollover());
    }//GEN-LAST:event_jButton10StateChanged

    private void jButton11StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jButton11StateChanged
        // TODO add your handling code here:
        AbstractButton aButton = (AbstractButton) evt.getSource();
        ButtonModel aModel = aButton.getModel();
        jButton11.setContentAreaFilled(aModel.isRollover());
    }//GEN-LAST:event_jButton11StateChanged

    private void btExitProgramActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExitProgramActionPerformed
        // TODO add your handling code here:
        closeGui();
    }//GEN-LAST:event_btExitProgramActionPerformed

    private void jButton13StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jButton13StateChanged
        // TODO add your handling code here:
        AbstractButton aButton = (AbstractButton) evt.getSource();
        ButtonModel aModel = aButton.getModel();
        jButton13.setContentAreaFilled(aModel.isRollover());
    }//GEN-LAST:event_jButton13StateChanged

    private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
        // TODO add your handling code here:
        setPanel(CLIENT_INFORMATION_SCREEN);
    }//GEN-LAST:event_jButton13ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        // TODO add your handling code here:
        logout();
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:   
        accountCreate = new AccountCreate(this);
        if(!lbAccount.getText().equals("admin")) accountCreate.diseanabledChoseAccount();
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        About about = new About();
        about.show();
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        // TODO add your handling code here:
        passwordChange = new PasswordChange(this);
        passwordChange.setVisible(true);
        this.setEnabled(false);
    }//GEN-LAST:event_jButton9ActionPerformed

    private void btCloseAllComputerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCloseAllComputerActionPerformed
        // TODO add your handling code here:
        int result = JOptionPane.showConfirmDialog(null, "Bạn muốn đóng tất cả các máy đang sử dụng không?", "Cảnh báo đóng tất cả các máy", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
        if (result == JOptionPane.YES_OPTION) {
            closeAllComputer();
        }
    }//GEN-LAST:event_btCloseAllComputerActionPerformed

    private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton22ActionPerformed
        // TODO add your handling code here:
        scStastistics.setViewportView(pnStastisticsDay);
    }//GEN-LAST:event_jButton22ActionPerformed

    private void jButton23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton23ActionPerformed
        // TODO add your handling code here:
        scStastistics.setViewportView(pnStastisticsMonth);
    }//GEN-LAST:event_jButton23ActionPerformed

    private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
        // TODO add your handling code here:
        scStastistics.setViewportView(pnStastisticsYear);
    }//GEN-LAST:event_jButton24ActionPerformed


    private void btViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btViewActionPerformed
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("Select username,namecom,employeename,timestart,timeend,cost from transactions,employee where transactions.employeeid=employee.employeeid");
        rsTotable(rs, Integer.parseInt(cbbDate.getSelectedItem().toString()), Integer.parseInt(cbbMouth.getSelectedItem().toString()), Integer.parseInt(cbbYear.getSelectedItem().toString()), Integer.parseInt(txtNumDate.getText()));
    }//GEN-LAST:event_btViewActionPerformed

    private void BT_ListAllClientsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BT_ListAllClientsActionPerformed
        String query = "SELECT USERNAME,MINSREMAIN,LASTLOGIN,LASTUSEMINS,LASTTRANSACTION,LASTDEPOSIT,DESCRIPTION FROM USER";
        ResultSet result = Login.dtConnect.retriveData(query);
        setDataForTableClient(result);
    }//GEN-LAST:event_BT_ListAllClientsActionPerformed

    private void btViewAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btViewAllActionPerformed
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("Select username,namecom,employeename,timestart,timeend,cost from transactions,employee where transactions.employeeid=employee.employeeid");
        rsTotable(rs);
    }//GEN-LAST:event_btViewAllActionPerformed

    private void btSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSearchActionPerformed
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("Select username,namecom,employeename,timestart,timeend,cost from transactions,employee where transactions.employeeid=employee.employeeid and username='" + txtUser.getText() + "'");
        rsTotable(rs);
    }//GEN-LAST:event_btSearchActionPerformed

    private void BT_SearchClientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BT_SearchClientActionPerformed
        String query;
        if (TF_ClientName.getText().equals("")) {
        } else {
            query = "SELECT USERNAME,MINSREMAIN,LASTLOGIN,LASTUSEMINS,LASTTRANSACTION,LASTDEPOSIT,DESCRIPTION FROM USER "
                    + "WHERE USERNAME='" + TF_ClientName.getText() + "'";
            ResultSet result = Login.dtConnect.retriveData(query);
            setDataForTableClient(result);
        }
    }//GEN-LAST:event_BT_SearchClientActionPerformed

    private void BT_SearchEmployeesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BT_SearchEmployeesActionPerformed
        String query;
        if (TF_EmployeeSearch.getText().equals("")) {
        } else {
            query = "SELECT EMPLOYEEID,EMPLOYEENAME,PHONE,SALARYPERHOUR,HOURCUMULATED,IDCARDNUMBER,DESCRIPTION FROM EMPLOYEE "
                    + "WHERE EMPLOYEENAME='" + TF_EmployeeSearch.getText() + "'";
            ResultSet result = Login.dtConnect.retriveData(query);
            setDataForTableEmployees(result);
        }
    }//GEN-LAST:event_BT_SearchEmployeesActionPerformed

    private void Table_ClientMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Table_ClientMouseClicked
        if (evt.getClickCount() == 2) {
            int row = Table_Client.getSelectedRow();
            String username = (String) Table_Client.getValueAt(row, 0);
            new InforUser(username, this);
        }
    }//GEN-LAST:event_Table_ClientMouseClicked

    private void BT_ListAllEmployeesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BT_ListAllEmployeesActionPerformed
        String query = "SELECT EMPLOYEEID,EMPLOYEENAME,PHONE,SALARYPERHOUR,HOURCUMULATED,IDCARDNUMBER,DESCRIPTION FROM EMPLOYEE";
        ResultSet result = Login.dtConnect.retriveData(query);
        setDataForTableEmployees(result);
    }//GEN-LAST:event_BT_ListAllEmployeesActionPerformed

    private void Table_EmployeesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Table_EmployeesMouseClicked
        // TODO add your handling code here:
        if (evt.getClickCount() == 2 && lbAccount.getText().equals("admin")) {
            try {
                int row = Table_Employees.getSelectedRow();
                String employee = Table_Employees.getModel().getValueAt(row, 1).toString();
                ResultSet rs = Login.dtConnect.retriveData("select * from employee where employeename='" + employee + "'");
                rs.next();
                InforEmploy infoE = new InforEmploy(this);
                infoE.lbEmployee.setText(employee);
                infoE.tfTel.setText(rs.getString("PHONE"));
                infoE.tfDescrip.setText(rs.getString("DESCRIPTION"));
            } catch (SQLException ex) {
                Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_Table_EmployeesMouseClicked

    private void btShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btShowActionPerformed
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("select * from day");
        rsTotableDraw(rs, tbDayStt, tbModel, Integer.parseInt(cbbDateStt.getSelectedItem().toString()), Integer.parseInt(cbbMonthStt.getSelectedItem().toString()), Integer.parseInt(cbbYearStt.getSelectedItem().toString()), Integer.parseInt(cbbSL.getSelectedItem().toString()));
        rs = Login.dtConnect.retriveData("select * from day");
        drawchart(rs, pnStatictis1, Integer.parseInt(cbbDateStt.getSelectedItem().toString()), Integer.parseInt(cbbMonthStt.getSelectedItem().toString()), Integer.parseInt(cbbYearStt.getSelectedItem().toString()), Integer.parseInt(cbbSL.getSelectedItem().toString()));
    }//GEN-LAST:event_btShowActionPerformed

    private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
        // TODO add your handling code here:
        setScreenStatus(ComputerPanel.OPEN, false);
    }//GEN-LAST:event_jButton16ActionPerformed

    private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
        // TODO add your handling code here:
        setScreenStatus(ComputerPanel.CLOSE, false);
    }//GEN-LAST:event_jButton17ActionPerformed

    private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
        // TODO add your handling code here:
        setScreenStatus(ComputerPanel.USE, false);
    }//GEN-LAST:event_jButton14ActionPerformed

    private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
        // TODO add your handling code here:
        setScreenStatus(1, true);
    }//GEN-LAST:event_jButton15ActionPerformed

    private void btShow2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btShow2ActionPerformed
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("select * from month");
        rsTotableDraw(rs, tbMonthStt, tbModel, 0, Integer.parseInt(cbbMonthStt2.getSelectedItem().toString()), Integer.parseInt(cbbYearStt2.getSelectedItem().toString()), Integer.parseInt(cbbSL2.getSelectedItem().toString()));
        rs = Login.dtConnect.retriveData("select * from month");
        drawchart(rs, pnStatictis2, 0, Integer.parseInt(cbbMonthStt2.getSelectedItem().toString()), Integer.parseInt(cbbYearStt2.getSelectedItem().toString()), Integer.parseInt(cbbSL2.getSelectedItem().toString()));
    }//GEN-LAST:event_btShow2ActionPerformed

    private void btShow3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btShow3ActionPerformed
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("select * from year");
        rsTotableDraw(rs, tbYearStt, tbModel, 0, 0, Integer.parseInt(cbbYearStt3.getSelectedItem().toString()), Integer.parseInt(cbbSL3.getSelectedItem().toString()));
        rs = Login.dtConnect.retriveData("select * from year");
        drawchart(rs, pnStatictis3, 0, 0, Integer.parseInt(cbbYearStt3.getSelectedItem().toString()), Integer.parseInt(cbbSL3.getSelectedItem().toString()));
    }//GEN-LAST:event_btShow3ActionPerformed

    private void BT_ChangePriceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BT_ChangePriceActionPerformed
        String newPriceStr = "";
        int newPrice;
        while (true){
            newPriceStr = JOptionPane.showInputDialog("Nhập số tiền/giờ mới:");
            try{
                newPrice = Integer.parseInt(newPriceStr);
                if (newPrice > 0){
                     break;
                }
            }
            catch(NumberFormatException e){
                JOptionPane.showMessageDialog(null, "Nhập lỗi, vui lòng kiểm tra lại!");
            }
        }
        Login.pricePerHour = newPrice;
        LB_Price.setText("Đơn giá: "+Login.pricePerHour);
        ComputerPanel computer;
        int count = pnMainScreen.getComponentCount();
        for (int i = 0; i < count; i++){
              computer = ((ComputerPanel) pnComputerScreen.getComponent(i));
              if (computer.getStatus() != CLOSE)
                computer.UpdatePricePerHours(newPriceStr);
        }
    }//GEN-LAST:event_BT_ChangePriceActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("select * from month");
        rsTotableDraw(rs, tbMonthStt, tbModel, 0, Integer.parseInt(cbbMonthStt2.getSelectedItem().toString()), Integer.parseInt(cbbYearStt2.getSelectedItem().toString()), Integer.parseInt(cbbSL2.getSelectedItem().toString()));
        rs = Login.dtConnect.retriveData("select * from month");
        drawchart(rs, pnStatictis2, 0, Integer.parseInt(cbbMonthStt2.getSelectedItem().toString()), Integer.parseInt(cbbYearStt2.getSelectedItem().toString()), Integer.parseInt(cbbSL2.getSelectedItem().toString()));
    }

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:
        ResultSet rs = Login.dtConnect.retriveData("select * from year");
        rsTotableDraw(rs, tbYearStt, tbModel, 0, 0, Integer.parseInt(cbbYearStt3.getSelectedItem().toString()), Integer.parseInt(cbbSL3.getSelectedItem().toString()));
        rs = Login.dtConnect.retriveData("select * from year");
        drawchart(rs, pnStatictis3, 0, 0, Integer.parseInt(cbbYearStt3.getSelectedItem().toString()), Integer.parseInt(cbbSL3.getSelectedItem().toString()));
    }

    public void setDataForTableClient(ResultSet result) {
        try {
            Vector<String> colNames = new Vector<String>();
            Vector<Vector<Object>> tableData = new Vector<Vector<Object>>();
            ResultSetMetaData metadata = result.getMetaData();

            colNames.add("Tên khách hàng");
            //colNames.add("Chứng minh nhân dân");
            colNames.add("Số phút còn lại");
            colNames.add("Lần sử dụng cuối cùng");
            colNames.add("Số phút sử dụng trong lần sử dụng cuối");
            colNames.add("Lần nạp tiền cuối cùng");
            colNames.add("Số tiền nạp lần cuối");
            colNames.add("Ghi chú");

            while (result.next()) {
                Vector<Object> row = new Vector<Object>();
                for (int j = 1; j <= metadata.getColumnCount(); j++) {
                    row.add(result.getObject(j));
                }
                tableData.add(row);
            }
            Table_Client.setModel(getTableModel(colNames, tableData));
            //Table_Client.set
        } catch (SQLException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void setDataForTableTransaction(ResultSet result) {
        try {
            Vector<String> colNames = new Vector<String>();
            Vector<Vector<Object>> tableData = new Vector<Vector<Object>>();
            ResultSetMetaData metadata = result.getMetaData();

            colNames.add("Tên khách hàng");
            //colNames.add("Chứng minh nhân dân");
            colNames.add("Số phút còn lại");
            colNames.add("Lần sử dụng cuối cùng");
            colNames.add("Số phút sử dụng trong lần sử dụng cuối");
            colNames.add("Lần nạp tiền cuối cùng");
            colNames.add("Số tiền nạp lần cuối");
            colNames.add("Ghi chú");

            while (result.next()) {
                Vector<Object> row = new Vector<Object>();
                for (int j = 1; j <= metadata.getColumnCount(); j++) {
                    row.add(result.getObject(j));
                }
                tableData.add(row);
            }
            tbTransactionJournal.setModel(getTableModel(colNames, tableData));
            //Table_Client.set
        } catch (SQLException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void setDataForTableEmployees(ResultSet result) {
        try {
            Vector<String> colNames = new Vector<String>();
            Vector<Vector<Object>> tableData = new Vector<Vector<Object>>();
            ResultSetMetaData metadata = result.getMetaData();

            colNames.add("Mã nhân viên");
            colNames.add("Tên đăng nhập");
            colNames.add("Số điện thoại");
            colNames.add("Lương mỗi giờ (đồng)");
            colNames.add("Số giờ tích lũy");
            colNames.add("Chứng minh nhân dân");
            colNames.add("Mô tả");
            while (result.next()) {
                Vector<Object> row = new Vector<Object>();
                for (int j = 1; j <= metadata.getColumnCount(); j++) {
                    row.add(result.getObject(j));
                }
                tableData.add(row);
            }
            DefaultTableModel model = new DefaultTableModel(tableData, colNames) {
                @Override
                public boolean isCellEditable(int row, int column) {
                    return false;
                }
            };

            Table_Employees.setModel(model);
        } catch (SQLException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void rsTotableDraw(ResultSet rs, JTable tbStatic, DefaultTableModel dfModel, int ngay, int thang, int nam, int songay) {
        String[] strTitle = new String[]{"Thời gian", "Tiền"};
        tbModel = new DefaultTableModel(strTitle, 0) {
            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        System.out.println(ngay + "" + thang + "" + nam);
        int type = 0;
        if (ngay == 0) {
            type = 1;
        }
        if (thang == 0) {
            type = 2;
        }
        try {
            int dem = 0;
            int dataDate;
            int dataMount;
            int dataYear;
            while (rs.next()) {
                String[] rowData = new String[2];
                switch (type) {
                    case 0:
                        dataDate = rs.getInt(1);
                        dataMount = rs.getInt(2);
                        dataYear = rs.getInt(3);
                        break;
                    case 1:
                        dataDate = 0;
                        dataMount = rs.getInt(1);
                        dataYear = rs.getInt(2);
                        break;
                    default:
                        dataDate = 0;
                        dataMount = 0;
                        dataYear = rs.getInt(1);
                        break;

                }
                //System.out.println(dataDate+""+dataMount+""+dataYear);
                //-------------------------------
                if ((ngay == dataDate) && (thang == dataMount) && (nam == dataYear)) {
                    dem = 1;
                }
                if ((dem > 0) && (dem <= songay)) {
                    String time = "";
                    String inc = "";
                    for (int i = 0; i <= (2 - type); i++) {
                        time = time + "/" + rs.getString(i + 1);
                    }
                    inc = rs.getString(4 - type);

                    rowData[0] = time.substring(1);
                    rowData[1] = inc;
                    tbModel.addRow(rowData);
                    dem++;
                }
            }
        } catch (SQLException ex) {
            Logger.getLogger(MainScreen.class.getName()).log(Level.SEVERE, null, ex);
        }
        tbStatic.setModel(tbModel);
    }

    public void drawchart(ResultSet rs, JPanel pnChart, int ngay, int thang, int nam, int songay) {
        DefaultCategoryDataset datashet = new DefaultCategoryDataset();
        int type = 0;
        if (ngay == 0) {
            type = 1;
        }
        if (thang == 0) {
            type = 2;
        }
        try {
            int dem = 0;
            int dataDate;
            int dataMount;
            int dataYear;
            while (rs.next()) {
                String[] rowData = new String[2];
                //------------------------------

                switch (type) {
                    case 0:
                        dataDate = rs.getInt(1);
                        dataMount = rs.getInt(2);
                        dataYear = rs.getInt(3);
                        break;
                    case 1:
                        dataDate = 0;
                        dataMount = rs.getInt(1);
                        dataYear = rs.getInt(2);
                        break;
                    default:
                        dataDate = 0;
                        dataMount = 0;
                        dataYear = rs.getInt(1);
                        break;

                }
                if ((ngay == dataDate) && (thang == dataMount) && (nam == dataYear)) {
                    dem = 1;
                    System.out.println(songay);
                }
                if ((dem > 0) && (dem <= songay)) {
                    String time = "";
                    String inc = "";
                    for (int i = 0; i <= (2 - type); i++) {
                        time = time + "/" + rs.getString(i + 1);
                    }
                    inc = rs.getString(4 - type);
                    rowData[0] = time.substring(1);
                    rowData[1] = inc;
                    datashet.setValue(Integer.parseInt(rowData[1]), "Tiền", rowData[0]);
                    dem++;
                }
            }
            //---------------------------------
        } catch (SQLException ex) {

        }

        JFreeChart chart = ChartFactory.createBarChart("Thống kê tiền", "Thời gian", "Tiền", datashet, PlotOrientation.VERTICAL, false, true, false);
        CategoryPlot p = chart.getCategoryPlot();
        p.setRangeGridlinePaint(Color.BLUE);
        p.setBackgroundPaint(Color.WHITE);
        p.getRenderer().setBasePaint(Color.green);
        p.getRenderer().setSeriesPaint(0, Color.GREEN);
        ChartPanel chartpanel = new ChartPanel(chart);
        chartpanel.setMouseWheelEnabled(true);
        pnChart.setLayout(new java.awt.BorderLayout());
        pnChart.add(chartpanel, BorderLayout.CENTER);
        pnChart.validate();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BT_ChangePrice;
    private javax.swing.JButton BT_ListAllClients;
    private javax.swing.JButton BT_ListAllEmployees;
    private javax.swing.JButton BT_SearchClient;
    private javax.swing.JButton BT_SearchEmployees;
    private javax.swing.JLabel LB_IP;
    private javax.swing.JLabel LB_Price;
    private javax.swing.JTextField TF_ClientName;
    private javax.swing.JTextField TF_EmployeeSearch;
    private javax.swing.JTable Table_Client;
    private javax.swing.JTable Table_Employees;
    private javax.swing.JButton btCloseAllComputer;
    private javax.swing.JButton btExitProgram;
    private javax.swing.JButton btSearch;
    private javax.swing.JButton btShow;
    private javax.swing.JButton btShow2;
    private javax.swing.JButton btShow3;
    private javax.swing.JButton btView;
    private javax.swing.JButton btViewAll;
    private javax.swing.JComboBox cbbDate;
    private javax.swing.JComboBox cbbDateStt;
    private javax.swing.JComboBox cbbMonthStt;
    private javax.swing.JComboBox cbbMonthStt2;
    private javax.swing.JComboBox cbbMouth;
    private javax.swing.JComboBox cbbSL;
    private javax.swing.JComboBox cbbSL2;
    private javax.swing.JComboBox cbbSL3;
    private javax.swing.JComboBox cbbYear;
    private javax.swing.JComboBox cbbYearStt;
    private javax.swing.JComboBox cbbYearStt2;
    private javax.swing.JComboBox cbbYearStt3;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton16;
    private javax.swing.JButton jButton17;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton22;
    private javax.swing.JButton jButton23;
    private javax.swing.JButton jButton24;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel31;
    private javax.swing.JPanel jPanel32;
    private javax.swing.JPanel jPanel33;
    private javax.swing.JPanel jPanel34;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSplitPane jSplitPane3;
    private javax.swing.JSplitPane jSplitPane4;
    private javax.swing.JSplitPane jSplitPane5;
    public static javax.swing.JLabel lbAccount;
    private javax.swing.JLabel lbDay;
    private javax.swing.JLabel lbMouth;
    private javax.swing.JLabel lbYear;
    private javax.swing.JPanel pnClientInformation;
    private javax.swing.JPanel pnComputerScreen;
    private javax.swing.JPanel pnEmployInformation;
    private javax.swing.JPanel pnIcon;
    private javax.swing.JPanel pnMainScreen;
    private javax.swing.JPanel pnStastistics;
    private javax.swing.JPanel pnStastisticsDay;
    private javax.swing.JPanel pnStastisticsMonth;
    private javax.swing.JPanel pnStastisticsScreen;
    private javax.swing.JPanel pnStastisticsYear;
    private javax.swing.JPanel pnStatictis1;
    private javax.swing.JPanel pnStatictis2;
    private javax.swing.JPanel pnStatictis3;
    private javax.swing.JPanel pnStatusComputer;
    private javax.swing.JPanel pnTransactionJournal;
    private javax.swing.JScrollPane scStastistics;
    private javax.swing.JTable tbDayStt;
    private javax.swing.JTable tbMonthStt;
    private javax.swing.JTable tbTransactionJournal;
    private javax.swing.JTable tbYearStt;
    private javax.swing.JTextField txtNumDate;
    private javax.swing.JTextField txtUser;
    // End of variables declaration//GEN-END:variables

    public void logout() {
        this.dispose();
        login.show();
    }

}
